package com.hsgene.user.condition;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.hsgene.common.util.date.TimeJsonDeserializer;
import com.hsgene.common.util.support.LimitHelper;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 普通管理员（员工）查询条件
 *
 * @author wangbing
 * @version 1.0, 2018/8/20
 */
public class EmployeeCondition implements Serializable {

    private static final long serialVersionUID = -5748327391525679175L;
    /**
     * 查询起始时间
     */
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    private Date start;

    /**
     * 查询截止时间
     */
    @JsonDeserialize(using = TimeJsonDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    private Date end;

    /**
     * 查询关键字（用户名或手机号）
     */
    private String searchKey;

    /**
     * 供应商id
     */
    private Long supplierId;

    /**
     * 页号
     */
    private int page;

    /**
     * 每页大小
     */
    private int size;

    public LimitHelper buildLimitHelper() {
        return LimitHelper.create(page, size);
    }

    public LimitHelper buildLimitHelper(boolean isLimitMaxPageSize) {
        return LimitHelper.create(page, size, isLimitMaxPageSize);
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getEnd() {
        return end;
    }

    public void setEnd(Date end) {
        this.end = end;
    }

    public String getSearchKey() {
        return searchKey;
    }

    public void setSearchKey(String searchKey) {
        this.searchKey = searchKey;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }
}
